<template>
  <z-modal
    title="通知详情"
    :width="800"
    v-bind="modalOption"
    @cancel="handleCancel"
    :okButtonProps="{ class: { '!hidden': true }}"
    :bodyStyle="{padding:'0px'}"
  >
    <a-card :bordered="false">
      <a-card-meta :title="content.messageTitle" :description="'发布人：' + content.fromNickName + ' 发布时间： ' + content.createTime"> </a-card-meta>
      <a-divider />
      <span v-html="content.messageContent" class="article-content"></span>
    </a-card>
  </z-modal>
</template>

<script>
import ModalMixins from '@/mixins/ModalMixins'
import { getAction } from '@/services/manage'
export default {
  name: 'MessageModal',
  mixins: [ModalMixins],
  data() {
    return {
      url: {
        read: '/message/read/'
      },
      content: {},
      channelCode: ''
    }
  },
  methods: {
    show(data, channelCode) {
      this.visible = true
      this.content = data
      this.channelCode = channelCode
      this.read()
    },
    read() {
      getAction(`${this.url.read}${this.channelCode}/${this.content.id}`).then(res => {
        if (res.success) {
          console.log('已读')
          this.$emit('ok')
        }
      })
    }
  }
}
</script>
